<%@ page import="com.biz.conf.Global" %>
<%@ page import="com.biz.model.Singleton.ZkNode" %>
<%@ include file="/jsp/taglib.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>


    <link href="${ctxStatic}/plugins/h+/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/animate.min.css" rel="stylesheet">
    <%--<link href="${ctxStatic}/plugins/h+/css/style.min862f.css?v=4.1.0" rel="stylesheet">--%>
    <link rel="stylesheet" type="text/css" href="${ctxStatic}/plugins/h+/css/plugins/webuploader/webuploader.css">
    <link href="${ctxStatic}/plugins/h+/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">

    <link href="${ctxStatic}/plugins/h+/css/font-awesome.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/chosen/chosen.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/colorpicker/css/bootstrap-colorpicker.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/cropper/cropper.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/switchery/switchery.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/jasny/jasny-bootstrap.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/nouslider/jquery.nouislider.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/ionRangeSlider/ion.rangeSlider.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/ionRangeSlider/ion.rangeSlider.skinFlat.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/clockpicker/clockpicker.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/animate.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/style.min.css?v=4.0.0" rel="stylesheet"><base target="_blank">
    <link href="${pageContext.request.contextPath}/resources/plugins/h+/css/plugins/jsTree/style.min.css" rel="stylesheet">
    <style type="text/css">
        body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
    </style>
    <script src="${pageContext.request.contextPath}/resources/plugins/h+/js/jquery.min.js?v=2.1.4"></script>
    <script src="${pageContext.request.contextPath}/resources/plugins/h+/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="${pageContext.request.contextPath}/resources/plugins/h+/js/content.min.js?v=1.0.0"></script>
    <script src="${pageContext.request.contextPath}/resources/plugins/h+/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="${pageContext.request.contextPath}/resources/plugins/h+/js/plugins/validate/messages_zh.min.js"></script>
    <script src="${pageContext.request.contextPath}/resources/plugins/h+/js/demo/form-validate-demo.min.js"></script>
    <script src="${pageContext.request.contextPath}/resources/plugins/h+/js/plugins/layer2.4/layer.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/resources/plugins/ajaxfileupload.js"></script>
    <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
    <script src="${ctxStatic}/plugins/h+/js/plugins/chosen/chosen.jquery.js"></script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=jd6Hm9opBbRk7ttvtly1ouzAcF9pB56Y"></script>
    <title>地图展示</title>
    <style>
    .fixwidth_zk{
       width:120px;
       display: inline-block;
    }
    .mapheader{
        margin:10px 0;
    }
    .btmbtns_zk{
        margin-bottom: 10px;
    }
    </style>
</head>
<body>
<div class="col-xs-12 col-sm-12 mapheader">
    <div class="col-xs-5 col-sm-5">
        <input class="form-control" style="width: 70%;display: inline-block" type="text" id="searchtext" />
        <button class="btn btn-primary" type="button"  id="searchbt" onclick="search()" >搜索</button>
    </div>
    <div class="col-xs-7 col-sm-7 text-right">
        <label>经度</label>
        <input class="form-control fixwidth_zk" id="jing_du" readonly></input>
        <label>纬度</label>
        <input class="form-control fixwidth_zk" id="wei_du" readonly></input>
        <button class="btn btn-primary"  type="button" id="btn_save"
                onclick="doSave();">
            确定
        </button>
    </div>
</div>
<div id="allmap"></div>
</body>
</html>
<script type="text/javascript">
    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
    var longitude='${param.longitude}';
    // 百度地图API功能
    var map = new BMap.Map("allmap"); // 创建Map实例
    if(longitude!=null&&longitude!=""){
        var lng = longitude.split(",")[0];
        var lat = longitude.split(",")[1];
        $("#jing_du").val(lng);
        $("#wei_du").val(lat);
        map.centerAndZoom(new BMap.Point(lng,lat), 16);
    }else{
        map.centerAndZoom(new BMap.Point(121.616217,38.91957), 16); // 初始化地图,设置中心点坐标和地图级别
    }

    map.addControl(new BMap.MapTypeControl()); //添加地图类型控件
    map.setCurrentCity("北京"); // 设置地图显示的城市 此项是必须设置的
    map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
    //单击获取点击的经纬度
    map.addEventListener("click",function(e){
        var jing_du_value = e.point.lng ;
        var wei_du_value =  e.point.lat;
        $("#jing_du").val(jing_du_value);
        $("#wei_du").val(wei_du_value);
    });
    var city = new BMap.LocalSearch(map, { renderOptions: { map: map, autoViewport: true} });

    function search() {
        var s =$("#searchtext").val();
//        city.setSearchCompleteCallback(onSearchComplete);  // 设置检索结束后的回调函数。参数： results: LocalResult 或  Array<LocalResult> ,如果是多关键字检索，回调    // 函数参数为LocalResult 的数组，数组中的结果顺序和检索中多关键字数组中顺序一致。
        city.setSearchCompleteCallback(function (searchResult) {
            var poi = searchResult.getPoi(0);
            $("#jing_du").val(poi.point.lng);
            $("#wei_du").val(poi.point.lat);
        });
        city.search(s); //查找城市
    }
    function onSearchComplete(result){
        var n = result.getNumPois();   // 返回搜索结果数
    }
    
    function  doSave() {
        var lng=$("#jing_du").val();
        var lat=$("#wei_du").val();
        window.parent.getLat(lng,lat);
        parent.layer.close(index);
    }
</script>

